//
//  Base1ViewController.swift
//  funcode
//
//  Created by Wan Jiading on 2016/11/24.
//  Copyright © 2016年 WanJiading. All rights reserved.
//  自定义侧滑 

import UIKit

class Base1ViewController: UIViewController, UIGestureRecognizerDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()

		
		setCustomPop()
    }
	
	private func setCustomPop() {
		
		// 自定义侧滑返回功能
		let target = self.navigationController?.interactivePopGestureRecognizer?.delegate
		let panGR = UIPanGestureRecognizer(target: target, action: Selector(("handleNavigationTransition:")))
		panGR.delegate = self
		self.view.addGestureRecognizer(panGR)
		self.navigationController?.interactivePopGestureRecognizer?.isEnabled = false
	}
	
	func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
		if self.navigationController?.childViewControllers.count == 1 {
			return false
		}
		return true
	}

}
